package com.flutter_ecg.flutter_ecg.ecgapplication;

import android.content.Context;
import android.content.Intent;

import com.flutter_ecg.flutter_ecg.ecgapplication.ecgreportview.EcgReportActivity;
import com.flutter_ecg.flutter_ecg.ecgapplication.utils.Constants;

public class IKEcgReportController {
    private static IKEcgReportController instance;
    public static synchronized IKEcgReportController getInstance() {
        if (instance == null) {
            synchronized (IKEcgReportController.class) {
                if (instance == null) {
                    instance = new IKEcgReportController();
                }
            }
        }
        return instance;
    }
    /**
     * 显示心电分析结果。该方法由用户调用，启动心电报告回显功能
     * @param ecgSmartResult 心电分析结果，即json格式的字符串，参考文档中IKGetCurrEcgSmartResult方法给出的格式。
     * @param tarFilePath 心电数据报告文件，格式为全路径+文件名
     */
    public void showEcgReport(Context context, String ecgSmartResult, String tarFilePath) {
        Intent intent = new Intent(context, EcgReportActivity.class);
        intent.putExtra(Constants.TARTFILEPATH_KEY, tarFilePath);
        intent.putExtra(Constants.ECGRESMARTSULT_KEY, ecgSmartResult);

        context.startActivity(intent);
    }
}
